package com.woldier.zuul.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;

import com.woldier.zuul.entity.File;
import com.woldier.zuul.service.FileService;
import com.woldier.zuul.service.FileUpdateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 文件上传 的信息更新服务
 */
@Service
public class FileUpdateServiceImpl implements FileUpdateService {

    @Autowired
    FileService fileService;

    @Override
    public boolean update(File file) {
        LambdaQueryWrapper<File> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(File::getNameRepo,file.getNameRepo());
        lambdaQueryWrapper.eq(File::getPathFile,file.getPathFile());
        /*根据name_repo以及file_path进行更新*/
        boolean b = fileService.saveOrUpdate(file, lambdaQueryWrapper);
        return b;
    }
}
